type t = A of int * int | B of (int -> bool) | C | D of (int * char) | E of int
;;

let f x =
  match x with
    | A (a, b) ->
	print_string "A ("; print_int a; print_string ", ";
	print_int b; print_endline ")";
    | B f ->
	print_string "B (";
	print_string (string_of_bool (f 42));
	print_endline ")";
    | C ->
	print_endline "C";
    | D (n, c) ->
	print_string "D (";
	print_int n;
	print_string ", '";
	print_char c;
	print_endline "')";
    | E n ->
	print_string "E ";
	print_int n;
	print_newline ();
in
  List.iter f [
    A (3, 4);
    B (fun x -> x > 31);
    C;
    D (42, 'x');
    E 123;
  ]
;;

